package com.dragon.english_practice_back.mapper;

import com.dragon.english_practice_back.entity.Words;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Map;

/**
* @author 伫倚
* @description 针对表【words(单词表)】的数据库操作Mapper
* @createDate 2025-04-13 14:47:29
* @Entity com.example.english_practice_back.entity.Words
*/
public interface WordsMapper extends BaseMapper<Words> {

    @MapKey("id")
    List<Map<String, Object>> getWordsWithProficiency(long initialValue, long size, String orderBy, String order, Integer wordBookId);


    List<Integer> getWordIdsByBookId(Integer bookId);

    List<Integer> getWordIdsWithNotFullProficiencyByBookId(Integer userId, Integer bookId);

    @MapKey("id")
    List<Map<String, Object>> getWordsWithProficiencyByIds(int userId, List<Integer> wordIds);

    // 批量插入或更新,map的数据结构为{"user_id": "1", "word_id": "1", "proficiency": "100"}
    int batchInsertOrUpdate(@Param("list") List<Map<String, Object>> list);
}




